---
title: Vector Basemaps
description: Display <a href='https://www.esri.com/arcgis-blog/products/arcgis-living-atlas/mapping/whats-new-in-esri-vector-basemaps-december-2017/'>v1</a> ArcGIS Online vector basemaps using an <a href='https://github.com/Esri/esri-leaflet-vector'>experimental</a> plugin.
layout: example.hbs
---

<!-- load the latest release from the cdn automatically -->
<script src="https://unpkg.com/esri-leaflet-vector"></script>

<style>
  #basemaps-wrapper {
    position: absolute;
    top: 10px;
    right: 10px;
    z-index: 400;
    background: white;
    padding: 10px;
  }
  #basemaps {
    margin-bottom: 5px;
  }
</style>

<div id="map"></div>

<div id="basemaps-wrapper" class="leaflet-bar">
  <select name="basemaps" id="basemaps" onChange="changeBasemap(basemaps)">
    <option value="Newspaper">Newspaper</option>
    <option value="ModernAntique">ModernAntique</option>
    <option value="BlackAndWhite">BlackAndWhite</option>
    <option value="Spring">Spring</option>
    <option value="MidCentury">Mid-Century</option>
    <option value="Topographic">Topographic</option>
    <option value="Gray">Gray</option>
    <option value="DarkGray">Dark Gray</option>
    <option value="Navigation">Navigation</option>
    <option value="Streets">Streets</option>
    <option value="StreetsNight">Streets Night</option>
    <option value="StreetsRelief">Streets Relief</option>
  </select>
</div>

<script>
  var map = L.map('map').setView([40, -4], 6);
  var layer = L.esri.Vector.basemap('Newspaper').addTo(map);

  // v1 basemaps stopped receiving updates in Dec 2017
  function setBasemap(basemap) {
    if (layer) {
      map.removeLayer(layer);
    }

    layer = L.esri.Vector.basemap(basemap);
    map.addLayer(layer);
  }

  function changeBasemap(basemaps){
    var basemap = basemaps.value;
    setBasemap(basemap);
  }
</script>
